package com.prasanna.practice.controller
{
	import com.prasanna.practice.model.Model;
	import com.prasanna.practice.vo.IRVO;
	
	/**
	 * ...
	 * @author Prasanna Patra
	 */
	public class ParserController
	{
		private var model:Model = Model.instance;
		
		public function ParserController()
		{
		
		}
		
		public function parseXmlData(xmlData:XML):void
		{
			createVOs(xmlData);
		}
		
		private function createVOs(xmlData:XML):void
		{
			var irVOarr:Array = new Array();
			/*
			   SN = "1"
			   IR_TC_No = "IN015159-001"
			   LR = "L"
			   Upline_IR_ID_No = "NF527991-002"
			   Name = "PRASANNA PATRA"
			   Date = "41051"
			   Left_Volume = "8470"
			   Right_Volume = "16220"
			   BV = "500"
			   TC_Status = "4"
			 */
			
			for (var i:int = 0; i < xmlData.group.IR.length(); i++)
			{
				var irXML:XML = xmlData.group.IR[i];
				var irVO:IRVO = new IRVO();
				irVO.SN = int(irXML.@SN);
				if (irVO.SN == 0)
				{
					trace("pp-createVOs irXML.@SN :: " + irXML.@SN);
					continue;
				}
				
				irVO.IR_TC_No = irXML.@IR_TC_No;
				irVO.LR = irXML.@LR;
				irVO.Upline_IR_ID_No = int(irXML.@Upline_IR_ID_No);
				irVO.Name = irXML.@Name;
				irVO.Reg_Date = irXML.@Reg_Date;
				irVO.Left_Volume = int(irXML.@Left_Volume);
				irVO.Right_Volume = int(irXML.@Right_Volume);
				irVO.BV = int(irXML.@BV);
				irVO.TC_Status = int(irXML.@TC_Status);
				
				irVOarr.push(irVO);
			}
			model.irVOarr = irVOarr;
		}
	
	}

}